<?php
$form = $this->form;
$form->prepare();
$form->setAttribute('action', $this->url('user/register'));
$form->setAttribute('method', 'post');
?>
<div class="row">
    <?php if(count($flashMessages)) {
        foreach ($flashMessages as $msg) { ?>
            <div class="alert alert-block alert-success">
                <a class="close" data-dismiss="alert" href="#">×</a>
                <p><?php echo $this->translate($msg) ?></p>
            </div>
        <?php }
    } ?>

    <div class="col-sm-4 col-sm-offset-0 col-md-12 col-md-offset-0">
        <span class="text-center">
        </span>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Register</h3>
            </div>
            <div class="panel-body">
                <?php echo $this->form()->openTag($form); ?>
                <?php foreach ($form as $element): ?>
                    <?php if (!$element instanceof Zend\Form\Element\Button): ?>
                        <div class="form-group col-xs-12 <?php echo ($this->formElementErrors($element)) ? 'has-error' : '' ; ?>">
                            <div class="col-md-4">
                                <label for="<?php echo $element->getName();?>">
                                    <?php echo $element->getLabel(); ?>
                                </label>
                            </div>
                            <?php //echo $this->formLabel($element); ?>
                            <div class="col-md-8">
                                <?php echo $this->formInput($element) ?>
                                <div class="col-md-12">
                                    <div class="help-block">
                                        <?php echo $this->formElementErrors($element); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endif ?>
                    <?php /*if ($element instanceof Zend\Form\Element\Button): ?>
                        <div class="form-group col-xs-12 <?php echo ($this->formElementErrors($element)) ? 'has-error' : '' ; ?>">
                            <?php echo $this->formButton($element) ?>
                        </div>
                    <?php elseif ($element instanceof Zend\Form\Element\Captcha): ?>
                         <div class="form-group col-xs-12 <?php echo ($this->formElementErrors($element)) ? 'has-error' : '' ; ?>">
                            <?php echo $this->formCaptcha($element) . $this->formElementErrors($element) ?>
                         </div>
                    <?php else: ?>
                        <dd><?php //echo $this->formInput($element) . $this->formElementErrors($element) ?></dd>
                    <?php endif */ ?>
                <?php endforeach ?>
                <?php if ($this->redirect): ?>
                    <input type="hidden" name="redirect" value="<?php echo $this->escapeHtml($this->redirect) ?>" />
                <?php endif ?>
            </div>
            <div class="panel-footer text-center">
                <?php echo $this->formButton($element) ?>
            </div>
            <?php echo $this->form()->closeTag(); ?>
        </div>
    </div>
</div>
